import mongoose from 'mongoose';
const Schema = mongoose.Schema;
const ObjectId = Schema.ObjectId;
import moment from 'moment';

let Laf = new Schema({
  userId: {type: String, default: ''},
  userName: {type: String, default: ''},
  title: {type: String, default: ''},
  intro: {type: String, default: ''},
  position: {type: String, default: ''},
  contact: {type: String, default: ''},
  tags: [{type: ObjectId, required: true, ref: 'Tag'}],
  images: {type: Array, default: ''},
  type: {type: Number, default: 0}, // 0: 丢东西 1: 捡东西
  isDelete: {type: 'Boolean', default: false},
  createTime: {type: 'Number', default: Date.now()}
});

mongoose.model('Laf', Laf);

// Laf.pre('save', function (next) {
//   next()
// })

export default mongoose.model('Laf');